package com.xjl.javacore.code.ioexample.tcp;

import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * 创建发送端
 * @author xiaojinlu1990@163.com
 * @date 2020/1/21 9:45
 */
public class TcpClient {
    public static void main(String[] args) throws Exception {
        System.out.printf(InetAddress.getLocalHost()+"");
        Socket socket = new Socket("127.0.0.1",12321);

        OutputStream outputStream = socket.getOutputStream();
        String massage = "this is client data";
        outputStream.write(massage.getBytes());
        //outputStream.flush();

        outputStream.close();

    }
}
